#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
int main()
{
  //系统调用
  const char*str="hello write\n";
  write(1,str,strlen(str));
  //库函数
  const char*str1="hello fprintf\n";
  fprintf(stdout,"%s",str1);

  const char*str2="hello fwrite\n";
  fwrite(str2,strlen(str2),1,stdout);
  fork();























  //close(1);
  
  //int fd=open("./log.txt",O_WRONLY|O_CREAT|O_TRUNC,0666);
  //dup2(fd,1);
  //printf("printf\n");
//close(stdin->_fileno);
//  int fd1=open("./log1.c",O_WRONLY|O_CREAT|O_TRUNC,0666);
//  printf("fd1=%d\n",fd1);
//  int fd2=open("./log2.c",O_WRONLY|O_CREAT|O_TRUNC,0666);
//  printf("fd2=%d\n",fd2);
//  int fd3=open("./log3.c",O_WRONLY|O_CREAT|O_TRUNC,0666);
//  printf("fd3=%d\n",fd3);
//  int fd4=open("./log4.c",O_WRONLY|O_CREAT|O_TRUNC,0666);
//  printf("fd4=%d\n",fd4);
  //umask(0666);
  //int fd=open("./log.txt",O_WRONLY|O_CREAT|O_TRUNC,0666);
  //int fd=open("./log.txt",O_WRONLY|O_CREAT|O_APPEND,0666);
  //const char*str="hello linux";
  //CloudrResetPwdAgentrite(fd,str,strlen(str));
  //fwrite(str,strlen(str),1,fd);
  //printf("n=%d\n",n);
  //int cnt=60;
  //while(cnt--)
  //{
  //  printf("pid is%d\n",getpid());
  //  sleep(1);
  //}
  //FILE*fp=fopen("./log.txt","w");
  //if(fp==NULL)
  //{
  //  perror("fopen");
  // : return 1;
  //}
  //const char*str="hello world\n";
  //fputs(str,fp);
  ////fwrite(str,1,10,stdout);
  //fclose(fp);

  return 0;
}
